<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>客户来款</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" validate="{required:true}"
                               value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">客户ID</div>
                    <div class="field">
                        <input name="cstId" id="cstId" type="text" class="ui-textbox" validate="{number:true}"
                               value="">
                    </div>
                </div>
                <div class="formBtns notRight">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div class="fieldset1 tabel_col tabel_col_s clearFix">
        <div class="sqPanel">
            <div class="sqPanel_head inL">
                <span>客户来款</span>
            </div>
            <div class="sqPanel_body">
                <div id="fundGrid" class="sq-grid"></div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var form = null, fundGrid = null;
    $(function () {

        fundGrid = $("#fundGrid").ligerGrid({
            url: '<%=path%>/risk/rentRemind/initCstFundList.do',
            method: 'get',
            columns: [
                {
                    display: '资金编号', name: 'code', width: 180, align: 'left', enabledSort: false, flex: 1,
                    render: function (rowdata, index, value) {
                        return '<a style="cursor: pointer;" onclick="qyDecompose(' + rowdata.id + ');">' + rowdata.code + '</a>';
                    }
                },
                {display: '收款名称', name: 'acceptName', minWidth: 100, align: 'left', enabledSort: false, flex: 1},
                {
                    display: '交易日期',
                    name: 'acceptDate',
                    width: 100,
                    align: 'center',
                    enabledSort: false,
                    flex: 1,
                    render: renderDate
                },
                {
                    display: '实到日期',
                    name: 'acceptActualDate',
                    width: 100,
                    align: 'center',
                    enabledSort: false,
                    flex: 1,
                    render: renderDate
                },
                {display: '客户名称', name: 'cstNm', minWidth: 90, align: 'left', enabledSort: false, flex: 1,},
                {
                    display: '来款金额', name: 'amount', width: 90, align: 'right', enabledSort: false, flex: 1,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.amount / 100);
                    }
                },
                {
                    display: '可用金额', name: 'availableAmount', width: 90, align: 'right', enabledSort: false, flex: 1,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.availableAmount / 100);
                    }
                },
                {display: '备注', name: 'docketRem', minWidth: 100, align: 'left', enabledSort: false, flex: 1,},
            ],
            autoExpandColumn: 'description',
            usePager: false,
            delayLoad: true,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '400',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,
            alternatingRow: true
        });
        fundGrid.setHeight(100);


        form = $("#searchBar").ligerForm({
            validate: true
        });
        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                fundGrid.setParm(name, data[name]);
            }
            fundGrid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });


    });

    //查看分解单
    function qyDecompose(id) {
        Add_navTab('toDecomDtlPage_' + id, "分解单查看", '<%=path%>/capital/capFund/toDecomDtlPage.do?fundId=' + id, null);
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

</script>
</body>
</html>
